package com.west_traveler.tiyutoutiao.fragment.main_fragment;


import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.test.mock.MockApplication;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.west_traveler.tiyutoutiao.R;
import com.west_traveler.tiyutoutiao.application.BaseApplication;
import com.west_traveler.tiyutoutiao.databinding.FragmentHeadLineFrgBinding;
import com.west_traveler.tiyutoutiao.entity.head_line_entity.Head;
import com.west_traveler.tiyutoutiao.entity.head_line_entity.HeadData;
import com.west_traveler.tiyutoutiao.entity.head_line_entity.HeadLine;

import java.util.LinkedList;
import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * A simple {@link Fragment} subclass.
 */
public class HeadLineFrg extends Fragment implements Callback<HeadLine> {


    private FragmentHeadLineFrgBinding binding;

    public HeadLineFrg() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        binding = DataBindingUtil.inflate(LayoutInflater.from(container.getContext()), R.layout.fragment_head_line_frg, container, false);
        // Inflate the layout for this fragment
        return binding.getRoot();
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        //头条数据
        ((BaseApplication) getActivity().getApplication()).getService().getHeadLineData().enqueue(this);
        //动态数据


    }

    @Override
    public void onResponse(Call<HeadLine> call, Response<HeadLine> response) {
         //数据源
        List<Head> heads = response.body().getData().getHeads();

    }

    @Override
    public void onFailure(Call<HeadLine> call, Throwable t) {

    }
}
